class GenericNumber<Type> {
  defaultValue: Type
  add: (x: Type, y: Type) => Type
  constructor (defaultValue: Type, add: (x: Type, y: Type) => Type) {
    this.defaultValue = defaultValue
    this.add = add
  }
}

// let myGenericNumber = new GenericNumber<number>(100, (x, y) => x + y)
let myGenericNumber = new GenericNumber(100, (x, y) => x + y)
myGenericNumber.defaultValue = 0
console.log(myGenericNumber.add(1, 2))
console.log(myGenericNumber.defaultValue)